package main

import (
	"fmt"
	"time"
)

func pump1() chan int {
	ch := make(chan int)
	go func() {
		for i := 0; ; i++ {
			ch <- i * 2
		}
	}()
	return ch
}

func pump2() chan int {
	ch := make(chan int)
	go func() {
		for i := 0; ; i++ {
			ch <- i + 5
		}
	}()

	return ch
}

func suck(ch1, ch2 chan int) {
	go func() {
		for {
			select {
			case v := <-ch1:
				fmt.Println("Got int from chan1: ", v)
			case v := <-ch2:
				fmt.Println("Got int from chan2: ", v)
			}
		}
	}()
}

func main() {
	suck(pump1(), pump2())

	time.Sleep(1e9)
}
